﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using AD.IBLL;
using HZT.Core.Log;
using HZT.Framework.Web;

namespace AD.WebEx
{
    public abstract class ControllerBase : HZT.Framework.Web.ControllerBase
    {
        #region
        public virtual ICategoryService CategoryService
        {
            get
            {
                return ServiceContext.Current.CategoryService;
            }
        }

        public virtual IPeriodService PeriodService
        {
            get
            {
                return ServiceContext.Current.PeriodService;
            }
  
        }
        public virtual ICustomerService CustomerService
        {
            get
            {
                return ServiceContext.Current.CustomerService;
            }

        }
        #endregion
        //广告业务服务
        public virtual IADService ADService
        {
            get
            {
                return ServiceContext.Current.ADService;
            }
        }
        //部门信息服务
        public virtual IDeptService DeptService
        {
            get
            {
                return ServiceContext.Current.DeptService;
            }
        }

        protected override void LogException(Exception exception,
            WebExceptionContext exceptionContext = null)
        {
            base.LogException(exception);

            var message = new
            {
                exception = exception.Message,
                exceptionContext = exceptionContext,
            };

            Log4NetHelper.Error(LoggerType.WebExceptionLog, message, exception);
        }

        public IDictionary<string, object> CurrentActionParameters { get; set; }

        protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);
        }

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
        }
    }
}
